﻿using System;
using System.Text;
using System.Text.RegularExpressions;

namespace BaseSyntax.Values.StringTest
{
	// stringBuilder 改变自身字符串
	public class Builder:ITest
	{
		public void Test()
		{
			string str1 = "ni hao xxx you xxx";

			str1.Replace("x", "y");
			Console.WriteLine(str1);
			
			StringBuilder stringBuilder = new StringBuilder(str1);

			stringBuilder.Replace("x", "y");
			
			// 不影响原字符串
			Regex.Replace(str1, "x", "b");
			
			string str = stringBuilder.ToString();
			Console.WriteLine(stringBuilder);

		}
	}
}